package com.lineage.server.serverpackets;

import com.lineage.server.model.Instance.L1PcInstance;

public class S_PacketBoxCooking extends ServerBasePacket {
  private byte[] _byte;
  
  public static final int COOK_WINDOW = 52;
  
  public static final int ICON_COOKING = 53;
  
  public S_PacketBoxCooking(int value) {
    this._byte = null;
    writeC(250);
    writeC(52);
    writeC(219);
    writeC(49);
    writeC(223);
    writeC(2);
    writeC(1);
    writeC(value);
  }
  
  public S_PacketBoxCooking(L1PcInstance pc, int type, int time) {
    this._byte = null;
    writeC(250);
    writeC(53);
    int food = pc.get_food() * 10 - 250;
    if (food < 0)
      food = 0; 
    switch (type) {
      case 7:
        writeC(pc.getStr());
        writeC(pc.getInt());
        writeC(pc.getWis());
        writeC(pc.getDex());
        writeC(pc.getCon());
        writeC(pc.getCha());
        writeH(food);
        writeC(type);
        writeC(36);
        writeH(time);
        writeC(0);
        return;
      case 54:
        writeC(0);
        writeC(0);
        writeC(0);
        writeC(0);
        writeC(0);
        writeC(0);
        writeH(0);
        writeC(type);
        writeC(42);
        writeH(time);
        writeC(0);
        return;
    } 
    writeC(pc.getStr());
    writeC(pc.getInt());
    writeC(pc.getWis());
    writeC(pc.getDex());
    writeC(pc.getCon());
    writeC(pc.getCha());
    writeH(food);
    writeC(type);
    writeC(38);
    writeH(time);
    writeC(0);
  }
  
  public byte[] getContent() {
    if (this._byte == null)
      this._byte = getBytes(); 
    return this._byte;
  }
  
  public String getType() {
    return getClass().getSimpleName();
  }
}
